package com.bwie.goods.service.impl;

import com.bwie.common.domain.City;
import com.bwie.common.result.Result;
import com.bwie.goods.mapper.CityMapper;
import com.bwie.goods.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CityServiceimpl implements CityService {
    @Autowired
    CityMapper cityMapper;

    @Autowired
    RedisTemplate redisTemplate;

    @Override
    public Result<List<City>> list() {
        List<City> list=cityMapper.list();
        //系统启动时把这些字典数据存储在redis中
        redisTemplate.opsForList().range("city",0,-1);
        return Result.success(list);
    }
}
